package com.xhtt;

import com.xhtt.datasource.config.DynamicDataSourceConfigHikari;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;


@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
@Import({DynamicDataSourceConfigHikari.class})
@MapperScan("com.xhtt.modules.**.dao")
@EnableAsync//开启异步
@EnableScheduling//开启定时任务
public class AdminApplication extends SpringBootServletInitializer {
//	@Autowired
//	DataSource dataSource;
	public static void main(String[] args) {
		SpringApplication.run(AdminApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(AdminApplication.class);
	}

//	@Override
//	public void run(String... args) throws Exception {
//		System.out.println("DATASOURCE = " + dataSource);//123test
//	}
}
